/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ecom.perssistance;

import ecom.entity.ProductBean;
import java.util.List;

/**
 *
 * @author simonrichard
 */
public class ProductDAO extends AbstractDAO {

    public static String NAME = "name";

    public ProductDAO() {
        super();
    }

    /**
     * Insert a new Product into the database.
     * @param event
     */
    public void create(ProductBean event) throws DataAccessLayerException {
        super.saveOrUpdate(event);
    }


    /**
     * Delete a detached Product from the database.
     * @param event
     */
    public void delete(ProductBean event) throws DataAccessLayerException {
        super.delete(event);
    }

    /**
     * Find an Event by its primary key.
     * @param id
     * @return
     */
    public ProductBean find(Integer id) throws DataAccessLayerException {
        return (ProductBean) super.find(ProductBean.class, id);
    }

    /**
     * Updates the state of a detached Event.
     *
     * @param event
     */
    public void update(ProductBean event) throws DataAccessLayerException {
        super.saveOrUpdate(event);
    }

    /**
     * Finds all products in the database.
     * @return
     */
    public List<ProductBean> findAll() throws DataAccessLayerException{
        return super.findAll(ProductBean.class);
    }
}
